import { mapGetters } from 'vuex'
import { parseTime } from '@/utils/index'

export default {
    data() {
        return {
            cols: [{
                    key: 'subjectId',
                    label: '学科',
                    formatter: (row) => {
                        if (row.subjectId) {
                            return this.subjectEnum[row.subjectId]
                        }
                    }
                },
                {
                    key: 'chapterName',
                    label: '章',
                    showTooltip: true
                },
                {
                    key: 'sectionName',
                    label: '节',
                    showTooltip: true
                },
                {
                    key: 'questionType',
                    label: '题型',
                    formatter: (row) => {
                        if (row.questionType) {
                            return this.questionTypeEnum[row.questionType]
                        }
                    },
                    showTooltip: true
                },
                {
                    key: 'shortTitle',
                    label: '题干'
                },
                {
                    key: 'score',
                    label: '分数'
                },
                {
                    key: 'difficult',
                    label: '难度'
                },
                {
                    key: 'createTime',
                    label: '创建时间',
                    formatter: (row) => {
                        if (row.createTime) {
                            return parseTime(row.createTime)
                        }
                    },
                    notAllowEdit: true
                }
            ]
        }
    },
    computed: {
        ...mapGetters(['subjectEnum', 'paperTypeEnum', 'questionTypeEnum'])
    }
}